Imports System.IO
Public Class SendWaitDemo

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If lvData.Columns.Count = 0 Then
            lvData.Columns.Add("Name", 100, 0)
            lvData.Columns.Add("Size", 50, 0)
            lvData.Columns.Add("Date", 70, 0)
            lvData.View = View.Details
        End If
        Try
            lvData.Items.Clear()
            Dim dir As New DirectoryInfo("C:\Windows")
            Dim item1 As ListViewItem
            Dim i As Integer = 0

            Dim d As FileInfo
            For Each d In dir.GetFiles("*.*")
                item1 = New ListViewItem(d.Name)
                item1.SubItems.Add(d.Length.ToString())
                item1.SubItems.Add(d.CreationTime.ToLongDateString())
                lvData.Items.Add(item1)
                i = i + 1
            Next
            Label1.Text = "Files: " + i.ToString()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub SendWaitDemo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        SendKeys.SendWait("{Enter}")
        Label1.Text = "Enter được nhấn"
    End Sub


End Class